<?php
/*
Engineer: Derek Shue
Secondary: Sean Margison
Updated: 12/5/2011
Description: Displays teacher courses associated with their id.
*/
 ?>
<ul>
    <li>
        <a href="<?php echo $this->url(array('controller'=>'teacher','action'=>'browsecourses')) ?>">View Past Courses</a>
    </li>
    <li>
	<a href="<?php echo $this->url(array('controller'=>'teacher','action'=>'submitcourse')) ?>">Submit New Course</a>
    </li>
</ul>

<?php if($this->courses):?>
<h3>Your current courses (edit by clicking course name):</h3>
<table>
    <tr>
        <th>Course Name</th>
        <th>Department</th>
        <th>Course Number</th>
        <th>Term</th>
        <th>Action</th>
    </tr>
    <?php foreach($this->courses as $course): ?>
    <tr>
        <td align="center"><a href="
		<?php echo $this->url(array('controller'=>'common','action'=>'viewcoursedetails','cid'=>$course['CID'])); ?>"><?php echo $course['COURSENAME'] ?></a></td>
	<td align="center"><?php echo $course['DEPARTMENT']?></td>
	<td align="center"><?php echo $course['COURSENUMBER'] ?></td>
        <td><?php echo $course['TERM'] ?></td>
	<td align="center">
		<a href="<?php echo $this->url(array('controller'=>'teacher','action'=>'deletecourse','CID'=>$course['CID'])); ?>">Delete</a>
	</td> 	
    </tr>
    <?php endforeach ?>
<?php endif; ?>
<?php if(!$this->courses):?>
	<h3>You have no current courses.</h3>
<?php endif; ?>
</table>

